package com.example.ck.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.ck.dao.ProfessionalDao;
import com.example.ck.entity.Professional;
import com.example.ck.service.ProfessionalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 职称类型表
 * (Professional)表服务实现类
 *
 * @author makejava
 * @since 2024-05-01 12:14:45
 */
@Service
public class ProfessionalServiceImpl implements ProfessionalService {
    @Autowired
    private ProfessionalDao professionalDao;

    /**
     * 获取所有职称类型
     *
     * @return
     */
    @Override
    public List<Professional> queryAll() {
        return professionalDao.selectList(null);
    }

    /**
     * 添加职称类型
     *
     * @param professional
     * @return
     */
    @Override
    public boolean addProfessional(Professional professional) {
        return professionalDao.insert(professional) > 0;
    }

    /**
     * 删除职称类型
     *
     * @param professional
     * @return
     */
    @Override
    public boolean deleteProfessional(String professional) {
        QueryWrapper qw = new QueryWrapper<>();
        qw.eq("professional", professional);
        return professionalDao.delete(qw) > 0;
    }
}
